package project1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

@Gomoku_Component("数据库连接类")
public class Mysql {
    Connection con;
    public static String user;
    public static String password;

    public Connection getConnection() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("数据库驱动加载成功！");
        } catch (ClassNotFoundException e) {
            e.getStackTrace();
        }
        user = "root";
        password = "xu2006522";

        try {
            con= DriverManager.getConnection("jdbc:mysql://localhost:3306/gomoku_user","root",password);
            System.out.println("数据库驱动成功！");
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return con;
    }
}